package com.luntan.util.web;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 *
 * @author MaShiQiong
 * @date 2016-11-14 11:57:39
 */
public class SysLogUtil {

	public static final String module = "com.luntan.logger";

	/**
	 * 写访问数据库的日志
	 *
	 */
	public static void logAccess(String logmessage) {
		Logger log = Logger.getLogger("luntan.access");
		log.log(module, Level.INFO, logmessage, null);
	}

	/**
	 * 写访问数据库的日志及异常信息
	 *
	 */
	public static void logAccess(String logmessage, Throwable ex) {
		Logger log = Logger.getLogger("luntan.access");
		log.log(module, Level.INFO, logmessage, ex);
	}

	public static void system(String errStr, Throwable e) {
		Logger log = Logger.getLogger("luntan.system");
		log.log(module, Level.ERROR, errStr, e);
	}

	public static void system(String errStr) {
		Logger log = Logger.getLogger("luntan.system");
		log.log(module, Level.ERROR, errStr, null);
	}

	public static void runtime(String runtime) {
		Logger log = Logger.getLogger("luntan.runtime");
		log.log(module, Level.INFO, runtime, null);
	}
}
